/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package alcatelparser.modules;

import alcatelparser.tags.DefaultParserTag;

/**
 *
 * @author geniuz
 */
public class DumpBuilder
{

    public DumpBuilder()
    {
    }

    public final String buildDump(int i, int j, int ai[])
    {
        int k = 0;
        int l = 0;
        int i1 = i;
        String s = "";
        while(i1 <= j) 
        {
            if(l == 0)
                s = (new StringBuilder()).append(s).append(getRowNumber(k)).toString();
            s = (new StringBuilder()).append(s).append(DefaultParserTag.toHex(ai[i1])).append(I.I(4987)).toString();
            i1++;
            if(l == 15)
            {
                l = 0;
                k++;
                s = (new StringBuilder()).append(s).append(I.I(4062)).toString();
            } else
            {
                l++;
            }
        }
        s = (new StringBuilder()).append(s).append(I.I(8639)).toString();
        return s;
    }

    private String getRowNumber(int i)
    {
        String s = (new StringBuilder()).append("").append(i).toString();
        int j = 4 - s.length();
        String s1 = "";
        for(int k = 0; k < j; k++)
            s1 = (new StringBuilder()).append(s1).append(I.I(548)).toString();

        s1 = (new StringBuilder()).append(s1).append(s).append(I.I(8636)).toString();
        return s1;
    }

    private static final int DUMP_NUMBERS = 15;
}
